//
//  testCPModal.swift
//  字典转模型
//
//  Created by chen on 15/3/12.
//  Copyright (c) 2015年 chen. All rights reserved.
//

import UIKit
import XCTest

class testCPModal: XCTestCase {

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample() {
        // This is an example of a functional test case.
        XCTAssert(true, "Pass")
    }

    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measureBlock() {
            // Put the code you want to measure the time of here.
        }
    }
    ///   var name: String = ""
//    let age: Int = 0
//    let book: Book = Book()
//    let books: [Book]? = nil
    func testSubInfoType() {
         let dic =  Person.InfoType()
         let resultDic = ["name":"","age":"","book":"Book","books":"Book"]
         println(dic)
         XCTAssertEqual(dic!, resultDic, "应该等于")
    }
    
    
    func testAllInfoType() {
         let dic = Student.allinfoType()
         println("开始")
         println(dic)
         let resultDic = ["name":"","age":"","book":"Book","books":"Book","scool":""]
         XCTAssertEqual(dic, resultDic, "应该等于")
        
    }
//    ///    var name: String = ""
//    let age: Int = 0
//    let book: Book = Book()
//    let books: [Book]? = nil
    func testobjectWithDiction() {
        
        let dic: NSDictionary = NSDictionary(dictionary: ["scool":"学校","book":["bookName":"ios编程宝典"],"books":[["bookName":"ios编程宝典"],["bookName":"安卓编程宝典"]]])
//        
         let modal = Student.objectWithDiction(dic) as! Student
     
         XCTAssertEqual(modal.book.bookName, "ios编程宝典", "equeal")
         XCTAssertEqual(modal.books![0].bookName, "ios编程宝典", "equeal")
       
    }
    
}
